<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>全选</title>
    <style>
       .btn {
           display: inline-block;
           width: 50px;
           /*height: 24px;*/
           line-height: 24px;
           background: #e5e5e5;
           text-align: center;
       }
    </style>
</head>
<body>
    <form>
        <span class="label">你喜欢的运动</span>   
        <input type="checkbox" name="sports" value="足球">足球
        <input type="checkbox" name="sports" value="篮球">篮球
        <input type="checkbox" name="sports" value="羽毛球">羽毛球 <br>
        <button name="btn" class="btn">全选</button>
    </form>
    <script src="js/jquery.js"></script>
    <script>

            var $btn = $(".btn");
            $btn.click(function(){
                $("[name=sports]:checkbox").prop("checked",true);
                return false;
            });
    </script>
</body>
</html>